<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<head>
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/gen-style.css"
	type="text/css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/mkv/jquery-ui.css"
	type="text/css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/makovo-style.css"
	type="text/css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/jquery.steps.css"
	type="text/css" />

<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/jquery-2.1.3.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/gen.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/jquery.steps.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/inegi.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/spin.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/auxiliares.js"></script>
<script type="text/javascript">
	//text ui-widget-content ui-corner-all
	var mVal = new Gen.Validator('val');
	$(function() {
		if (validaSesion("${sessionScope.LoginMenu}"))
			document.location = "index.jsp";
		var form = $("#EditUser").show();

		form.steps({
			headerTag : "h3",
			bodyTag : "fieldset",
			transitionEffect : "slideLeft",
			showFinishButtonAlways : false,
			enableFinishButton : false
		});

		$('[name=state]').change(function() {
			var stateId = $(this).val();
			$('[name=loc]').find('option').remove();
			$('[name=loc]').append($('<option value="-1">... Selecciones una opción ...</option>'))
			$('[name=lonng]').val("");
			$('[name=lat]').val("");

			$('[name=stateId]').val(stateId);
		});
		Inegi.fillStates($('[name=state]'));
	});
	function validate() {
		var ret = false;
		var eqPassword = false;

		var errors = mVal.validate($('[name=EditUser]'), function() {
		});

		if ($('[name=pass]').val() != "" && $('[name=pass]').val() == $('[name=confirmPass]').val()) {
			eqPassword = true;
			$('[name=pass]').removeClass('t-error');
			$('[name=confirmPass]').removeClass('t-error');
		} else {
			$('[name=pass]').addClass('t-error');
			$('[name=confirmPass]').addClass('t-error');
		}

		if (errors.length != 0 || !eqPassword) {
			$('#EditUser').steps('previous');

		}

		if (errors.length == 0 && eqPassword)
			ret = true;

		return ret;
	}
</script>

</head>
<body>
	<div style="width: 1100px; margin: 0 auto">
		<div class="headerMK">
			<div class="logo">
				<span class="hdTitulo">Sistema para Aplicación de Subsidio
					2015</span>
			</div>
			<div
				style="font-size: 0.26em; top: -50px; position: relative; width: 500px; float: right; text-align: right; padding-right: 10px">
				<i>${sessionScope.LoginNombre}</i><b><a
					href="/makovo/paginas/index.jsp"> - Cerrar Sesión</a></b>
			</div>
		</div>
		<div class="divContenido">
			<a href="<%=request.getContextPath()%>/paginas/menu.jsp">Regresar
				al menú</a><br />
			<h3>Cambio de password</h3>
			<div style="width: 1000px; margin: -5px auto;" id="tab">
				<s:form action="EditUser">
					<h3>Nuevo de password</h3>
					<fieldset>
						<div style="width: 100%; float: left; padding-top: 10px">
							<div style="float: left; padding-left: 10px">
								Antiguo Password:
								<s:password name="oldPass" theme="simple" cssClass="inputText"
									val="password" />
							</div>
							<div style="float: left; padding-left: 10px">
								Password:
								<s:password name="pass" theme="simple" cssClass="inputText"
									val="password" />
							</div>
							<div style="float: left; padding-left: 10px">
								Confirmar Password:
								<s:password name="confirmPass" theme="simple"
									cssClass="inputText" val="password" />
							</div>
						</div>
						<s:if test="hasActionErrors()">
							<div class="server-error" id="server-error">
								<span class="server-error-title">Verifique los siguientes
									campos:</span><br />
								<s:actionerror />
							</div>
							<script>
								$(function() {
									$('#server-error').dialog({
										autoOpen : true,
										resizable : true,

										width : 500,
										modal : true,
										buttons : {
											'Cerrar' : function() {
												$(this).dialog("close");
											}
										}
									});
								});
							</script>
						</s:if>
					</fieldset>

					<h3>Finalizar</h3>
					<fieldset>
						<s:submit value="Guardar cambios" theme="simple"
							cssClass="class java.util.HashMap t-btn tinny change"
							onClick="if (!validate()) return false;" />
					</fieldset>
				</s:form>
			</div>
		</div>
	</div>
</body>
</html>